//
// Copyright (C) [2024] Xingyun Integrated Circuit, Inc.
//
// GreenCode was a private technology asset of Xingyun Integrated Circuit， Inc （Confidential）
//  Author: Shawn.Tan
//  Date : 2025.10.28
//
//  History : Initial Version 2025.10.28
//
//
#ifndef Green_ImageIO_H
#define Green_ImageIO_H

#include <map>
#include <string>

#include "Defines.h"

namespace Green {

  class Memory;
  class RegisterFile;
  class ImagePrinter;
  class ImageLoader;
  /*!
    \class ImageIO
    \brief print/load memory and register in text format.
   */
  class ImageIO {
  public:
    ImageIO(); //!< Default constructor
    ~ImageIO(); //!< Destructor
    ASSIGNMENT_OPERATOR_ABSENT(ImageIO);
    COPY_CONSTRUCTOR_ABSENT(ImageIO);
    void PrintMemoryImage(const std::string& imageFile, const Memory* memory);  //!< write memory initial data to an image file.
    void PrintRegistersImage(const std::string& imageFile, const std::map<std::string, uint64>& threadInfo, const RegisterFile* regFile); //!< write registers initial value to an Text file.

    void LoadMemoryImage(const std::string& imageFile, Memory* memory); //!< load memory initial data from an image file.
    void LoadRegistersImage(const std::string& imageFile, std::map<std::string, uint64>& threadInfo, RegisterFile* registerFile); //!< load registers initial value from an Text file.
  private:
    ImagePrinter* mpImagePrinter; //!< pointer of Image Printer.
    ImageLoader* mpImageLoader; //!< pointer of Image Loader.
  };

}
#endif
